下拉刷新思路
listview 已经出来了
要自定义RfreshListView extends ListView
addHeadView();

要把头view的布局加载进去

init(){
    headView = inflate(R.layout.refresh_item);
    addView(headView);
}

headView 的布局:
相对布局

布局调好了  注意最外层父布局是水平线性布局  两个子布局中marginTop和 bottom
<RelativeLayout
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"

相对布局中完全对齐不是用gravity 而是用 
layout_centerInParent = true;
**********************************************
progeressBar 设置
<ProgressBar
style="@android:style/Widget.ProgressBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:indeterminateDrawable="@drawable/drawable_indeterminate"
**********************************************

drawable_indeterminate.xml

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:drawable="@drawable/indicate_rotate"
android:toDegrees="360"
>
**********************************************

<style name="Widget.ProgressBar">
<item name="indeterminateOnly">true</item>
<item name="indeterminateDrawable">@drawable/progress_medium_white</item>
<item name="indeterminateBehavior">repeat</item>
<item name="indeterminateDuration">3500</item>
<item name="minWidth">48dip</item>
<item name="maxWidth">48dip</item>
<item name="minHeight">48dip</item>
<item name="maxHeight">48dip</item>
<item name="mirrorForRtl">false</item>
</style>

资源路径:
/Users/lizhichao/Library/Android/sdk/platforms/android-19/data/res/drawable/progress_medium_white.xml
//文件 progress_medium_white.xml
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/spinner_white_48"  //图片资源
    android:pivotX="50%"  //离中心
    android:pivotY="50%"
    android:framesCount="12"  
    android:frameDuration="100" />


  *********************************  

    测量view高度:
    //context 既可以传人 也可以用getContext() 不是太理解
    final  View headView =  View.inflate(/*ct*/getContext(), R.layout.layout_refresh_head, null);
    1.getMeasuredHeight
 headView.measure(0, 0);//主动通知系统去测量该view;  不能少
 int height = headView.getMeasuredHeight();
 headView.setPadding(0,-height,0,0);

 2.getHeight
 headView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
     @Override
     public void onGlobalLayout() {
            //移除监听  不然会一直调用
         headView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
           //    headView.getViewTreeObserver().removeOnGlobalLayoutListener(this);//高版本 16
               int headViewHeight = headView.getHeight();//为0
               headView.setPadding(0,-headViewHeight,0,0);
               Log.e("执行", "headViewHeight: " + headViewHeight);
           }
       });
 *********************************  

 *********************************  



 *********************************  



 *********************************  




 *********************************  


 *********************************  



 *********************************  
